<?php

/**
 * 自定义标签库
 */
namespace Home\TagLib;

use Think\Template\TagLib;
class TagLibHd extends TagLib
{
    protected $tags=array(
        'nav'=>array('attr'=>'limit,order','close'=>1),
    );

    public function _nav($attr,$content){
        $str=<<<STR
<?php
    \$list=M('cate')->order("{$attr['order']}")->limit("{$attr['limit']}")->select();
    \$cate=unlimitedForLayer(\$list);
    foreach(\$cate as \$vo):
    \$url=U('/list/'.\$vo['id']);
?>
STR;
        $str.=$content;
        $str.="<?php endforeach;?>";
        return $str;
    }
}